import type { VNode, CSSProperties } from 'vue';
import type { DescriptionsProps } from 'ant-design-vue/es/descriptions';
import type { Recordable } from '@vben/types';

export interface DescItem {
  labelMinWidth?: number;
  contentMinWidth?: number;
  labelStyle?: CSSProperties;
  fieldName: string;
  label: string | VNode | JSX.Element;
  span?: number;
  show?: (...arg: any) => boolean;
  render?: (val: any, data: Recordable) => VNode | undefined | JSX.Element | Element | string | number;
}

export interface DescriptionSlots {
  default?: () => VNode[];
  header?: () => VNode[];
  footer?: () => VNode[];
  [key: string]: (() => VNode[]) | undefined;
}

export interface DescriptionProps extends DescriptionsProps {
  title?: string;
  showTitle?: boolean;
  size?: 'default' | 'middle' | 'small';
  colon?: boolean;
  bordered?: boolean;
  column?: object | number;
  labelStyle?: string | VNode | JSX.Element;
  schema: DescItem[];
  data: Recordable;
}

export interface DescInstance {
  setDescProps(descProps: Partial<DescriptionProps>): void;
}

export type Register = (descInstance: DescInstance) => void;

export type UseDescReturnType = [Register, DescInstance];
